package qianmian;

public class Teacher extends Person {
    private Course taughtCourse;

    public Teacher(String id, String name, String sex) {
        super(id, name, sex);
    }

    public void openCourse(Course course) {
        this.taughtCourse = course;
        course.setTeacher(this);
        System.out.println("教师【" + super.name + "】开课成功：" + course.getName());
    }


    public void printWorksheet() {
        System.out.println("\n===== 教师授课信息 =====");
        System.out.println("教师编号：" + super.id);
        System.out.println("教师姓名：" + super.name);
        System.out.println("教师性别：" + super.sex);
        
        if (this.taughtCourse != null) {
            System.out.println("所授课程编号：" + this.taughtCourse.getId());
            System.out.println("所授课程名称：" + this.taughtCourse.getName());
            System.out.println("上课地点：" + this.taughtCourse.getLocation());
            System.out.println("上课时间：" + this.taughtCourse.getTime());
        } else {
            System.out.println("授课状态：暂无授课课程");
        }
        System.out.println("=======================\n");
    }

    public Course getTaughtCourse() {
        return taughtCourse;
    }
}
